package com.liit.module.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.liit.module.dao.ProductDao;
import com.liit.module.entity.Product;
import com.liit.module.frame.utils.page.Pagination;
import com.liit.module.service.ProductService;

/**
 * @author dingweibo
 * @Title: ProductServiceImpl.java
 * @Description: 产品服务实现
 * @date 2015年12月18日
 */
@Service("productService")
public class ProductServiceImpl implements ProductService {

	@Autowired
	ProductDao productDao;

	@Override
	public Map<String, Object> listPage(Pagination pagination, Product record) {
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("list", productDao.listPage(pagination, record));
		result.put("page", pagination);
		return result;
	}

	@Override
	public Product selectById(Integer id) {
		return productDao.selectById(id);
	}

	@Override
	public int updateById(Product record) {
		return productDao.updateById(record);
	}

	@Override
	public int deleteById(Integer id) {
		return productDao.deleteById(id);
	}

	@Override
	public int insertAndReturnPK(Product record) {
		productDao.insert(record);
		return record.getId();
	}

	@Override
	public int update(Product record) {
		return productDao.update(record);
	}

}
